<?php

namespace app\modules\user\controllers;

use app\common\controllers\AccessController;
use app\modules\user\services\UserService;
use yii\base\UserException;

class UserController extends AccessController{

    //头像
    public function actionThumbnail($thumbnail){
        if(UserService::updateThumbnail(\Yii::$app->getModule("user")->get("user")->getId(),$thumbnail)){
            return "";
        }else{
            throw new UserException(UserService::getError());
        }
    }

    //用户名
    public function actionUsername($username){
        if(UserService::updateUsername(\Yii::$app->getModule("user")->get("user")->getId(),$username)){
            return "";
        }else{
            throw new UserException(UserService::getError());
        }
    }
}